/*  This file is part of -_-.

    -_- is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    -_- is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with -_-.  If not, see <http://www.gnu.org/licenses/>.

    Copyright 2012-2013 Oliver Katz */

#ifndef __ARCH_H
#define __ARCH_H

#include <iostream>
#include <memory>
#include "../opal/parser.h" // for the memusage function
#include "module.h"

//namespace sleepyface::arch
namespace sleepyface
{
	namespace arch
	{
		//class Architecture: the architecture of any -_- program
		class Architecture
		{
		private:
			string name;
			map<string, shared_ptr<ArchModule> > mods;
			int argc;
			char **argv;
			
		public:
			Architecture(string n); //methodof Architecture: initializer with program name
			string getName(); //methodof Architecture: gets the program name
			string load(ArchModule *m, vector<ModuleValue> data); //methodof Architecture: loads a module with 'data' as value arguments for the initialization signal
			string load(ArchModule *m); //methodof Architecture: loads a module
			string load(ArchModule *m, ModuleValue v0); //methodof Architecture: loads a module with one value argument
			int loadRequiredInternals(); //methodof Architecture: load required internal modules
			int loadOptionalInternals(int argc, char *argv[]); //methodof Architecture: load all internal modules according to cli args
			bool isLoaded(string n); //methodof Architecture: checks to see if a module is loaded
			int unload(string n); //methodof Architecture: unloads a module
			int size(); //methodof Architecture: gets the number of modules
			vector<string> list(); //methodof Architecture: lists the loaded modules
			ArchModule *module(string n); //methodof Architecture: gets a module with the name 'n'
			int cliArgs(int argc, char *argv[]); //methodof Architecture: processes command line arguments in all loaded modules
			int getArgc(); //methodof Architecture: gets the value of argc (internal use only)
			char **getArgv(); //methodof Architecture: gets the value of argv (internal use only)
			int getMemoryUsage(); //methodof Architecture: returns the memory usage of the current process in bytes
		};
	}
}

#endif
